import React,{ Component } from 'react';
import { Modal,ListView } from 'antd-mobile';
import { Link } from 'react-router-dom';
import HeaderNav from '../modules/HeaderNav';
import {AlertBox} from '../modules/AlertBox';

class NameForm extends React.Component{
    constructor(props){
        super(props);
        this.state = {value:''}
    }
    handleChang = (e) =>{
        this.setState({value:e.target.value})
    }
    handleSubmit = (e) =>{
        e.preventDefault();
        alert('提交名字：'+this.state.value)
    }
    render(){
        return (
            <form action="" onSubmit={this.handleSubmit}>
                <label htmlFor="">
                    名字：<input name="userName" type="text" value={this.state.value} onChange={this.handleChang}/>
                </label>
                <input type="submit" value="提交"/>
            </form>
        )
    }
}



class Home extends Component{
  constructor(props) {
    super(props);
  }
  handleClickShare = ()=>{
    AlertBox.show({
      button:["确定","取消"],
      content:<div>
        <p>liyingying！</p>
      </div>,
      success: () =>{
       return  <p>你好啊！</p>
      }
    })
  };
  componentDidMount(){
    // AlertBox.show({
    //   button:["确定"],
    //   content:<div>
    //     <p>liyingying！</p>
    //   </div>,
    // })
  }
  render(){
    return (
      <div>
        <HeaderNav name="端午节活动" />
        <span onClick={this.handleClickShare.bind(this)}>liyingying5555555</span>
          <NameForm />
          <Link to="/thermometer"><p>温度计</p></Link>
          <Link to="/context"><p>context的用法</p></Link>

      </div>
    )
  }
}

export default Home;